import { ApiProperty } from '@quick-toolkit/http';
import { Any, Typed, TypedArray } from '@quick-toolkit/class-transformer';

export class PageInfo<T> {
  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public endRow: number;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public firstPage: number;

  @ApiProperty({
    type: 'boolean',
    description: '',
  })
  @Typed(Boolean)
  public hasNextPage: boolean;

  @ApiProperty({
    type: 'boolean',
    description: '',
  })
  @Typed(Boolean)
  public hasPreviousPage: boolean;

  @ApiProperty({
    type: 'boolean',
    description: '',
  })
  @Typed(Boolean)
  public isFirstPage: boolean;

  @ApiProperty({
    type: 'boolean',
    description: '',
  })
  @Typed(Boolean)
  public isLastPage: boolean;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public lastPage: number;

  @ApiProperty({
    type: 'array',
    description: '',
  })
  @TypedArray(Any)
  public list: T[];

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public navigatePages: number;

  @ApiProperty({
    type: 'array',
    description: '',
  })
  @TypedArray(Number)
  public navigatepageNums: number[];

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public nextPage: number;

  @ApiProperty({
    type: 'string',
    description: '',
  })
  @Typed(String)
  public orderBy: string;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public pageNum: number;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public pageSize: number;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public pages: number;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public prePage: number;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public size: number;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public startRow: number;

  @ApiProperty({
    type: 'integer',
    description: '',
  })
  @Typed(Number)
  public total: number;
}
